package com.cloud.rou.im.client.api.event;

import com.cloud.rou.im.msg.enumtype.AckType;

import java.util.Arrays;

/**
 * <p></p>
 *
 * @author GaoShuangWen
 */
public enum IMClientEvent {

    /**
     * the client online
     */
    online,

    /**
     * the client offline
     */
    offline,

    /**
     * the client offline
     */
    read,

    /**
     * the client has send one msg
     */
    hasSend,

    /**
     * the client has read one msg
     */
    hasRead,

    /**
     * the client has delivered one msg
     */
    hasDelivered,

    /**
     * exception
     */
    exception;


    public static IMClientEvent getEventByAckType(AckType type) {
        IMClientEvent event;
        switch (type) {
            case OFFLINE:
                event = IMClientEvent.offline;
                break;
            case READ:
                event = IMClientEvent.hasRead;
                break;
            case DELIVERED:
                event = IMClientEvent.hasDelivered;
                break;
            case LOGIN_SUCCESS:
                event = IMClientEvent.online;
                break;
            default:
                event = IMClientEvent.exception;
                break;
        }
        return event;
    }
}
